package com.googlecode.groovycpp.transform

import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.tools.ast.TestHarnessClassLoader
import org.junit.Test;

class CPlusPlusASTTransformationTest extends GroovyTestCase {
	@Test
	void testAstTransformation() {

		def invoker = new GroovyClassLoader(); //new TestHarnessClassLoader(new CPlusPlusASTTransformation(), CompilePhase.SEMANTIC_ANALYSIS);
		def clazz = invoker.parseClass(
"@com.googlecode.groovycpp.annotations.LocalAnnotation class DeanTest {\n" + 
"   public DeanTest() { }\n"+ 
"   public void test() { println \"Test4\"}\n"+
"}\n")
		def out = clazz.newInstance()
		out.test();
		
		def file = invoker.parseClass(new File("src/test/groovy/com/googlecode/groovycpp/transform/TestFile2.java"))
		file.newInstance();
		//assert out.divide10By(2) == 5

		//def exceptionMessage = shouldFail { out.divide10By(0) }
		//assert exceptionMessage =~ /Precondition violated/
	}
}
